package cn.liujianbo.example;

import cn.liujianbo.example.convertor.CarConvertor;
import cn.liujianbo.example.domain.Car;
import cn.liujianbo.example.dto.CarDto;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 刘建波
 * @date 2021-10-14 21:50
 */
public class Test {
    public static void main(String[] args) {
        CarConvertor carConvertor = CarConvertor.INSTANCE;
        CarDto carDto = carConvertor.carToCarDto(new Car("Morris", 5, Car.CarType.SMALL));
        System.out.println("carDto = " + carDto);

        System.out.println("car =" + carConvertor.carDtoToCar(carDto));

        List<Car> carList = new ArrayList<>();
        carList.add(new Car("A", 5, Car.CarType.SMALL));
        carList.add(new Car("B", 15, Car.CarType.BIG));
        carList.add(new Car("C", 8, Car.CarType.BIG));

        List<CarDto> carDtos = carConvertor.carToCarDtos(carList);
        System.out.println(carDtos.toString());
        System.out.println(carConvertor.carDtoToCars(carDtos));
    }
}
